export const VERSION = '0.13';

export const FIELDS = {
  WELCOME_AT: 'welcome_at',
  USER_NAME: 'username',
  ORGANIZATION_ID: 'org_id',
  TOKEN_NAME: 'token',
  TOKEN_PASSWORD: 'token_password',
};

export const TITLES = {
  TODAY: '每日任务',
  ORDER: '订单管理',
  METRICS: '实时监督',
};

export const taskStatus = {
  UNASSIGNED: 'unassigned',
  ASSIGNED: 'assigned',
  RUNNING: 'running',
  PAUSED: 'paused',
  DONE: 'done',
  ABORTED: 'aborted',
};

export const orderStatus = {
  NEW: 'new',
  RUNNING: 'running',
  PAUSED: 'paused',
  DONE: 'done',
  ABORTED: 'aborted',
};

export const MANU_STATUS_GROUP = {
  active: [taskStatus.RUNNING, taskStatus.PAUSED, taskStatus.DONE],
  completed: [taskStatus.DONE],
  uncompleted: [taskStatus.UNASSIGNED, taskStatus.ASSIGNED, taskStatus.RUNNING, taskStatus.PAUSED],
};

export const qcTaskStatus = {
  NEW: 'new',
  RUNNING: 'running',
  DONE: 'done',
};

export const QC_STATUS_GROUP = {
  active: [qcTaskStatus.RUNNING, qcTaskStatus.DONE],
  completed: [qcTaskStatus.DONE],
  uncompleted: [qcTaskStatus.NEW, qcTaskStatus.RUNNING],
};

export const materialQcTaskStatus = {
  NEW: 'new',
  RUNNING: 'running',
  DONE: 'done',
};

export const taskActions = {
  ASSIGN: 'assign',
  START: 'start',
  PAUSE: 'pause',
  RESUME: 'resume',
  FINISH: 'finish',
  ABORT: 'abort',
  REOPEN: 'reopen',
};

export const ORDER_STATUS_LABEL = {
  unassigned: {
    color: 'grey',
    text: '未分配',
  },
  assigned: {
    color: 'blue',
    text: '已分配',
  },
  running: {
    color: 'green',
    text: '进行中',
  },
  paused: {
    color: 'darkgoldenrod',
    text: '暂停中',
  },
  done: {
    color: 'darkgreen',
    text: '已完成',
  },
  aborted: {
    color: 'red',
    text: '已废弃',
  },
};

export const ORDER_ACTION_LABEL = {
  start: {
    color: 'grey',
    text: '开始',
  },
  pause: {
    color: 'grey',
    text: '暂停',
  },
  resume: {
    color: 'grey',
    text: '恢复生产',
  },
  finish: {
    color: 'grey',
    text: '完成',
  },
  abort: {
    color: 'grey',
    text: '废弃',
  },
  reopen: {
    color: 'grey',
    text: '撤销完成状态',
  },
  enter: {
    color: 'grey',
    text: '进入',
  },
};

export const BOM_CATEGORY = {
  raw: '来料',
  semi: '半成品',
  prod: '成品',
};

export const TASK_ACTIONS = (status) => {
  switch (status) {
    case 'assigned':
      return ['start'];
    case 'running':
      return ['enter', 'pause', 'finish'];
    case 'paused':
      return ['resume', 'finish'];
    case 'closed':
      return ['reopen'];
    default:
      return ['undefined'];
  }
};

export const INFO = (status) => {
  const dict = {};
  return dict[status];
};

export const TabsHeaderHeight = 85;
export const BottomButtonHeight = 100;
export const HelpSwitch = false;
